﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

#region Using

using System.Diagnostics;
using System.Reflection;
#endregion

namespace NetBay.Core.Diagnostics
{
    public static class Method
    {

        #region Enums

        public enum Level
        {
            Father = 1,
            GrandFather = 2,
        }
        #endregion

        #region Constants
        #endregion

        #region Functions

        #region Publics
        /// <summary>
        /// 
        /// </summary>
        /// <param name="p_iLevel"></param>
        /// <returns></returns>
        public static string GetMethodBaseName(Level p_enLevel)
        {
            string l_sMethodName = string.Empty;
            StackTrace stackTrace = new StackTrace();
            if (stackTrace.FrameCount > (int)p_enLevel)
            {
                MethodBase methodBase = stackTrace.GetFrame((int)p_enLevel).GetMethod();
                l_sMethodName = methodBase.Name;
            }
            return l_sMethodName;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="p_iLevel"></param>
        /// <returns></returns>
        public static string GetClassBaseName(int p_iLevel)
        {
            string l_sClassName = string.Empty;
            StackTrace stackTrace = new StackTrace();
            if (stackTrace.FrameCount > p_iLevel)
            {
                MethodBase methodBase = stackTrace.GetFrame(p_iLevel).GetMethod();
                l_sClassName = methodBase.ReflectedType.FullName;
            }
            return l_sClassName;
        }
        #endregion

        #region Privates
        #endregion

        #region ToString
        #endregion

        #endregion


       
            
    }
}
